// Facebook collection view
window.FBPostsCollectionView = Backbone.View.extend({
  el: $("#fbposts"),

  initialize: function() {
    this.render();

    this.collection.on("reset", this.render, this);
    this.collection.on("add", this.renderPost, this);
    this.collection.on("remove", this.removePost, this);
  },

  render: function() {
    this.$el.find("div").remove();

    _.each(this.collection.models, function (item) {
      this.renderPost(item);
    }, this);
  },

  renderPost: function(item) {
    var fbPostView = new FBPostView({
      model: item
    });
    this.$el.append(fbPostView.render().el);
  },

  removePost: function(item) {

  }
});

window.fbPostsView = new FBPostsCollectionView({
collection: fbPosts
});